interface Product {
    String createProduct();
}

class ConcreteProductA implements Product {
    public String createProduct() {
        return "创建了产品A";
    }
}

class ConcreteProductB implements Product {
    public String createProduct() {
        return "创建了产品B";
    }
}

class FactoryPattern {
    public Product getProduct(String type) {
        if ("A".equals(type)) {
            return new ConcreteProductA();
        } else if ("B".equals(type)) {
            return new ConcreteProductB();
        }
        return null;
    }
}